{% extends 'base.html' %}

{% block page-content %}
            <div class="row">
                <div class="col-lg-12">
                    <h1 class="page-header">部门添加</h1>
                </div>
                <!-- /.col-lg-12 -->
            </div>
            <!-- /.row -->
            <div class="row">

                <div class="col-lg-8">
                    <div class="panel panel-default">
                        <div class="panel-heading">
                            部门添加
                        </div>
                        <div  class="panel-body">
                    <form class="form-horizontal nice-validator n-yellow" method="post"  >
                        <div class="form-group"><label class="col-sm-2 control-label"> 部门 <span class="red-fonts">*</span></label>
                            <div class="col-sm-6"><input type="text" class="form-control" name="dept_name" placeholder="运维部" required></div>
                        </div>

                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <div class="col-sm-4 col-sm-offset-5">
                                <button type="reset"  class="btn btn-white"> 重置 </button>
                                <button type="button" class="btn btn-primary" id="postset"> 提交 </button>
                            </div>
                        </div>
                        {% csrf_token %}
                    </form>
                    </div>
                    <!-- /.panel -->

                      <div class="modal fade" id="myModal" tabindex="-1" role="dialog"  id="myModal" aria-labelledby="myModalLabel">
                      <div class="modal-dialog" role="document">
                        <div class="modal-content">
                          <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                            <h4 class="modal-title" id="myModalLabel">系统提示</h4>
                          </div>
                          <div class="modal-body">
                                 <p id="getdata">ddddddd</p>
                          </div>

                            <div class="modal-footer">
                                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                                    <a class="btn btn-primary" href="/account/dept/list/">确定</a>
                            </div>

                        </div>
                      </div>
                    </div>


                  <script>
                       $(function(){
                            $("#postset").click(function() {
                                $.post("",
                                         {dept_name: $("input[name='dept_name']").val(),
                                               csrfmiddlewaretoken: '{{ csrf_token }}'},
                                         function (data) {
                                            $("#getdata").html(data);
                                            $('#myModal').modal('show');
                                        });
                            });
                        });
                  </script>


                </div>
            </div>
            <!-- /.row -->
      {% endblock %}

